<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
<h:head>
    <title>Jstorm UI</title>
</h:head>

<h:body>
<h:outputLink value="cluster.jsf">
    <h1>
        <h:outputText value="JStorm UI"/>
    </h1>
</h:outputLink>

<h2>Cluster Summary</h2>

<h:form>
    <p:dataTable id="clustesummary" var="cls" value="#{mainpage.csumm}">

        <p:column>
            <f:facet name="header">
                <h:outputText value="Nimbus Master"/>
            </f:facet>
            <h:outputText value="#{cls.nimbusHostname}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Nimbus uptime"/>
            </f:facet>
            <h:outputText value="#{cls.nimbusUptime}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Supervisors"/>
            </f:facet>
            <h:outputText value="#{cls.supervisorNum}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Port Slot"/>
            </f:facet>
            <h:form>
                <p:dataTable id="portsummary" var="cls1" value="#{mainpage.csumm}">
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Total"/>
                        </f:facet>
                        <h:outputText value="#{cls1.totalPortSlotNum}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Used"/>
                        </f:facet>
                        <h:outputText value="#{cls1.usedPortSlotNum}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Free"/>
                        </f:facet>
                        <h:outputText value="#{cls1.freePortSlotNum}"/>
                    </p:column>
                </p:dataTable>
            </h:form>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="CPU Slot"/>
            </f:facet>
            <h:form>
                <p:dataTable id="cpusummary" var="cls2" value="#{mainpage.csumm}">
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Total"/>
                        </f:facet>
                        <h:outputText value="#{cls2.totalCpuSlotNum}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Used"/>
                        </f:facet>
                        <h:outputText value="#{cls2.usedCpuSlotNum}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Free"/>
                        </f:facet>
                        <h:outputText value="#{cls2.freeCpuSlotNum}"/>
                    </p:column>
                </p:dataTable>
            </h:form>

        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Memory Slot"/>
            </f:facet>
            <h:form>
                <p:dataTable id="memsummary" var="cls3" value="#{mainpage.csumm}">
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Total"/>
                        </f:facet>
                        <h:outputText value="#{cls3.totalMemSlotNum}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Used"/>
                        </f:facet>
                        <h:outputText value="#{cls3.usedMemSlotNum}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Free"/>
                        </f:facet>
                        <h:outputText value="#{cls3.freeMemSlotNum}"/>
                    </p:column>
                </p:dataTable>
            </h:form>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Disk Slot"/>
            </f:facet>
            <h:form>
                <p:dataTable id="disksummary" var="cls4" value="#{mainpage.csumm}">
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Total"/>
                        </f:facet>
                        <h:outputText value="#{cls4.totalDiskSlotNum}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Used"/>
                        </f:facet>
                        <h:outputText value="#{cls4.usedDiskSlotNum}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Free"/>
                        </f:facet>
                        <h:outputText value="#{cls4.freeDiskSlotNum}"/>
                    </p:column>
                </p:dataTable>
            </h:form>
        </p:column>


        <!--
        <p:column>
            <f:facet name="header">
                <h:outputText value="Running tasks" />
            </f:facet>
            <h:outputText value="#{cls.runningTaskNum}" />
        </p:column>
         -->
    </p:dataTable>
</h:form>

<h2>Topology Summary</h2>
<h:form>
    <p:dataTable id="topologysummary" var="topo" value="#{mainpage.tsumm}"
                 sortBy="#{topo.uptime}" sortOrder="ASCENDING">

        <p:column>
            <f:facet name="header">
                <h:outputText value="Topology Name"/>
            </f:facet>

            <h:outputLink value="topology.jsf">
                <h:outputText value="#{topo.topologyName}"/>
                <f:param name="topologyid" value="#{topo.topologyId}"/>
            </h:outputLink>

        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Topology Id"/>
            </f:facet>
            <h:outputText value="#{topo.topologyId}"/>

        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Status"/>
            </f:facet>
            <h:outputText value="#{topo.status}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Uptime"/>
            </f:facet>
            <h:outputText value="#{topo.uptime}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Worker Num"/>
            </f:facet>
            <h:outputText value="#{topo.numWorkers}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Task Num"/>
            </f:facet>
            <h:outputText value="#{topo.numTasks}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Cpu Num"/>
            </f:facet>
            <h:outputText value="#{topo.numCpu}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Memory Num"/>
            </f:facet>
            <h:outputText value="#{topo.numMem}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Disk num"/>
            </f:facet>
            <h:outputText value="#{topo.numDisk}"/>
        </p:column>
    </p:dataTable>
</h:form>

<h2>Supervisor Summary</h2>
<h:form>
    <p:dataTable id="supervisorsummary" var="ssumm"
                 value="#{mainpage.ssumm}" sortBy="#{ssumm.host}"
                 sortOrder="ASCENDING">
        <p:column>
            <f:facet name="header">
                <h:outputText value="Host"/>
            </f:facet>

            <h:outputLink value="supervisor.jsf">
                <h:outputText value="#{ssumm.host}"/>
                <f:param name="host" value="#{ssumm.host}"/>
            </h:outputLink>
        </p:column>


        <p:column>
            <f:facet name="header">
                <h:outputText value="Uptime"/>
            </f:facet>
            <h:outputText value="#{ssumm.uptime}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Total Port"/>
            </f:facet>
            <h:outputText value="#{ssumm.totalPort}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Used Port"/>
            </f:facet>
            <h:outputText value="#{ssumm.usedPort}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Total Cpu"/>
            </f:facet>
            <h:outputText value="#{ssumm.totalCpu}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Used Cpu"/>
            </f:facet>
            <h:outputText value="#{ssumm.usedCpu}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Total Memory"/>
            </f:facet>
            <h:outputText value="#{ssumm.totalMem}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Used Memory"/>
            </f:facet>
            <h:outputText value="#{ssumm.usedMem}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Total Disk"/>
            </f:facet>
            <h:outputText value="#{ssumm.totalDisk}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <h:outputText value="Used Disk"/>
            </f:facet>
            <h:outputText value="#{ssumm.usedDisk}"/>
        </p:column>

    </p:dataTable>
</h:form>
</h:body>
</html>